package com.ld.hpfs.service.impl;

import java.util.ArrayList;
import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ld.hpfs.dao.DealSendMsgMapper;
import com.ld.hpfs.service.DealSendMsgService;

@Service
public class DealSendMsgServiceImpl implements DealSendMsgService {

	private static final Logger logger = LoggerFactory
			.getLogger(DealSendMsgServiceImpl.class);

	@Autowired
	private DealSendMsgMapper dealsendmsgmapper;

	@Override
	public ArrayList<HashMap<String, Object>> getDealSendList(
			HashMap<String, Object> param) {
		int count = dealsendmsgmapper.getDealSendListCount(param);
		if (count == 0) {
			return null;
		} else {
			param.put("pageCount", count);
			return dealsendmsgmapper.getDealSendList(param);
		}
	}

	@Override
	public ArrayList<HashMap<String, Object>> getMsgForPreview(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getMsgForPreview(param);
	}
	
	@Override
	public ArrayList<HashMap<String, Object>> getCusName(HashMap<String,Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getCusName(param);
	}

	@Override
	public ArrayList<HashMap<String, Object>> getDocNo(HashMap<String,Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getDocNo(param);
	}

	@Override
	public ArrayList<HashMap<String, Object>> getMsgForMail(
			HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getMsgForMail(param);
	}

	@Override
	public ArrayList<HashMap<String, Object>> getMsgForReplace(
			HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getMsgForReplace(param);
	}

	@Override
	public int updateSentDoc(HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		try{
			dealsendmsgmapper.updateSentDoc(param);
			return 0;
		}catch(Exception e){
			logger.error(e.getMessage());
			return -1;
		}
	}

	@Override
	public ArrayList<HashMap<String, Object>> getDealSendExpressNo(
			HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getDealSendExpressNo(param);
	}

	@Override
	public ArrayList<HashMap<String, Object>> getDealSendCust(
			HashMap<String, Object> param) {
		// TODO Auto-generated method stub
		return dealsendmsgmapper.getDealSendCust(param);
	}
}
